import 'package:flutter_jd/tools/data/mock.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class MessageController extends GetxController {
  int currentPage = 1;
  int lastPage = 1;
  List messageList = MESSAGE_LIST;
  RefreshController refreshController = RefreshController(
    initialRefresh: false,
  );

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onClose() {
    super.onClose();
  }

  // 下拉刷新
  onRefresh() async {
    refreshController.loadComplete();

    await Future.delayed(Duration(milliseconds: 600));
    refreshController.refreshCompleted();
  }

  // 加载更多
  onLoading() async {
    refreshController.loadNoData();
    await Future.delayed(Duration(milliseconds: 200));
  }
}
